package calao.util;

import java.io.PrintWriter;

public abstract class LogRecord 
{
	
	final long time;
	final LogLevel level;
	
	LogRecord(LogLevel level)
	{
		this.time = System.currentTimeMillis();
		this.level = level;
	}
	
	public abstract void writeMessage(PrintWriter writer);
	
	public long getTime()
	{
		return time;
	}
	
	public LogLevel getLevel()
	{
		return level;
	}
	
	void handleWith(LogHandler handler)
	{
		if (handler.handles(level)) handler.handle(this);
	}
	
}
